<template>
    <div>
        <el-dialog title="详情" :visible.sync="isOpen" width="60%" :before-close="closeDelDialog"
            :modal-append-to-body="false">
            <el-table :data="tableData" border style="width: 100%">
                <el-table-column type="index" width="50"  label="序号">
                </el-table-column>
                <el-table-column prop="pId" label="批次号">
                </el-table-column>
                <el-table-column prop="title" label="档案标题" >
                </el-table-column>
                <el-table-column prop="dh" label="档号">
                </el-table-column>
                <el-table-column prop="detectionResult" label="检测结果">
                    <template slot-scope="scope">
                    <!-- 1通过 0未通过 -->
                    <span>{{scope.row.detectionResult==1?'通过':'未通过'}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="address" label="操作">
                    <template slot-scope="scope">
                        <el-button plain type="success" size="mini" @click="handleDetail(scope.row)">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <pagination v-show="total > 0" :total="total" :page.sync="pageNum" :limit.sync="pageSize"
                @pagination="listByBatchIdList" />
        </el-dialog>

        <el-dialog title="结果详情" :visible.sync="isDetailOpen" width="60%" :before-close="closeDelDialog" :modal-append-to-body="false">
        <sxjcComponent istype="2" ref="child" :form="dataList" ></sxjcComponent>
     </el-dialog>
    </div>
</template>
<script>
import { logDetailsList } from '@/api/cqbc/inspectionData/inspectionLog.js'
import {inspectionLogs } from "@/api/cqbc/resourceManagement/yqCarriermanageDetail.js"
import sxjcComponent from "@/views/archive/archiveTransfer/sxjcComponent.vue";//移交四性检测详情， 打印用
export default {
    props: ["isOpen", 'row'],
    components: {
        sxjcComponent,
    },
    data() {
        return {
            Id: undefined,
            pageNum: 1,
            pageSize: 10,
            tableData: [],
            loading: true,
            total: 0,
            isDetailOpen: false,
            //检测信息
            dataList: [],
        }
    },
    watch: {
        row: {
            handler(val) {
                this.Id = val.id
                this.listByBatchIdList();
            }, immediate: true
        }
    },
    methods: {
        closeDelDialog() {
            this.isDetailOpen = false
            this.$emit("closeDelDialog")
        },
        listByBatchIdList() {
            logDetailsList({
                pId: this.Id,
                pageNum: this.pageNum,
                pageSize: this.pageSize,
            }).then(response => {
                this.tableData = response.rows
                this.total = response.total
                this.loading = false
            })
        },
        //查看详情
        handleDetail(row) {
            this.isDetailOpen = true
            inspectionLogs(row.detailsId).then(res => {
                this.dataList = res.data
            })
        }
    }
}
</script>
<style scoped></style>